//
//  UIBarButtonItem+Extensions.swift
//  MyXinLangWeiBo
//
//  Created by 迟浩伦 on 2016/12/23.
//  Copyright © 2016年 迟浩伦. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
//是否是返回按钮  如果是  加上箭头
    convenience init(title: String, fontSize: CGFloat = 16, target: Any?, action: Selector, isBack: Bool = false) {
      
        let btn: UIButton = UIButton.cz_textButton(title, fontSize: fontSize, normalColor: UIColor.gray, highlightedColor: UIColor.orange)
        
        if isBack{
            let imageName = "navigationbar_back_withtext"
        btn.setImage(UIImage(named: imageName), for: .normal)
            btn.setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
            btn.sizeToFit()
        }
        
        btn.addTarget(target, action: action, for: .touchUpInside)
        
      self.init(customView: btn)
        
    }

}
